package com.lineengine.lineengine.node;


import com.lineengine.lineengine.context.IContext;
import com.lineengine.lineengine.result.IResult;

/**
 * <p>
 * 节点
 * </p>
 *
 * @author wenrong.yu
 * @since 2020-11-07 21:20
 */
public abstract class AbstractNode<T extends IContext<T>> implements INode<T> {
    @Override
    public IResult<T> execute(T context) {
        return processWithRecordCostTime(context, () -> doExecute(context));
    }

    /**
     * 执行
     *
     * @param context 上下文
     * @return 结果
     */
    protected abstract IResult<T> doExecute(T context);
}
